using UnityEngine;

[ExecuteInEditMode]
public class PresetsBulletBallSpawner : MonoBehaviour
{
	public float bulletSpeed = 1f;

	public float delay;

	public float interval = 1f;

	public float intervalVariation;

	private ControllerBulletBallSpawner controller;

	private void LateUpdate()
	{
		if (Application.isEditor && !Application.isPlaying)
		{
			if (controller == null)
			{
				controller = base.gameObject.GetComponent<RemoteControl>().controller.GetComponent<ControllerBulletBallSpawner>();
				bulletSpeed = controller.bulletSpeed;
				delay = controller.delay;
				interval = controller.interval;
				intervalVariation = controller.intervalVariation;
			}
			SetValues();
		}
	}

	public void SetValues()
	{
		if (interval < 0.1f)
		{
			interval = 0.1f;
		}
		if (intervalVariation > interval * 0.4f)
		{
			intervalVariation = interval * 0.4f;
		}
		if (bulletSpeed < 0.1f)
		{
			bulletSpeed = 0.1f;
		}
		if (controller != null)
		{
			controller.bulletSpeed = bulletSpeed;
			controller.delay = delay;
			controller.interval = interval;
			controller.intervalVariation = intervalVariation;
		}
	}
}
